﻿using Eflong.DTO.Wcf;

namespace Eflong.Monitor
{
    public abstract class UpdateWork
    {
        public UpdateWork( )
        { }

        public uint Id { get; set; }

        public ConnectStates State { get; set; }

        /// <summary>
        /// 更新工作
        /// </summary>
        public abstract void DoWork( );
    }

    /// <summary>
    /// 更新测点定义
    /// </summary>
    public class DefinitionsUpdateWork : UpdateWork
    {
        public DefinitionsUpdateWork( ) { }

        public override void DoWork( )
        {
            //
            RealMonitorTask.getInstance( ).onDefinitiosnChanged( Id );
        }
    }

    /// <summary>
    /// 更新实时数据
    /// </summary>
    public class DatasUpdateWork : UpdateWork
    {
        public DatasUpdateWork( ) { }

        public override void DoWork( )
        {
            RealMonitorTask.getInstance( ).onDataChanged( Id );
        }
    }

    /// <summary>
    /// 更新联网状态
    /// </summary>
    public class CoalMineInfoUpdateWork : UpdateWork
    {
        public CoalMineInfoUpdateWork( ) { }

        public override void DoWork( )
        {
            CoalMineInfoTask.Instance( ).UpdateCoalMineInfo( Id , State );
        }
    }
}